#include "junix.h"
using namespace std;

class A
{
public:
	A(int ii=0):i(ii){}
	void print(A a)
	{
		cout<<sizeof(a)<<endl;
	}
	virtual void f()
	{
		cout<<"A::f()"<<endl;
	}
private:
	int i;
};

class B:public A
{
public:
	B(int ii=0,int jj=1):A(ii),j(jj){}
	void print(A a)//slice
	{
	//	A aa = a;
		cout<<sizeof(a)<<endl;
	}
	void f()
	{
		cout<<"B::f()"<<endl;
	}
private:
	int j;
};

int main(int argc, char **argv)
{

	A a(4);
	B b(6,7);
	a.print(a);
	b.print(b);

	A* pa=&b;
	pa->f();

	A& aa=b;
	aa.f();

	A aaa=b;//slice!!!
	aaa.f();
}
